#include <iostream>
#include <cstdio>
#include <vector> 
#include <algorithm>
#include <map> 

using namespace std; 

typedef long ll; 

map <string, ll> num_map; 

void init_map(void)
{
#define md(a, b) num_map[string(#a)] = b
	md(zero, 0); 
	md(one, 1); 
	md(two, 2); 
	md(three, 3); 
	md(four, 4); 
	md(five, 5); 
	md(six, 6); 
	md(seven, 7); 
	md(eight, 8); 
	md(nine, 9); 
	md(ten, 10); 
	md(eleven, 11); 
	md(twelve, 12); 
	md(thirteen, 13); 
	md(fourteen, 14); 
	md(fifteen, 15); 
	md(sixteen, 16); 
	md(seventeen, 17); 
	md(eighteen, 18); 
	md(nineteen, 19); 
	md(twenty, 20); 
	md(a, 1); 
	md(both, 2); 
	md(another, 1); 
	md(first, 1); 
	md(second, 2); 
	md(third, 3); 
}

string get_token(string sentence, unsigned &p)
{
	string ret; 
	int spc = 1; 
	while(p<sentence.size()) {
		if (spc) {
			if (sentence[p]!=' ') {
				spc = 0; 
				ret.push_back(sentence[p]); 
			} 
		} else {
			if (sentence[p]==' ') {
				return ret; 
			} else {
				ret.push_back(sentence[p]); 
			}
		}
		p++; 
	}
	return ret; 
}

int main()
{
	string line; 
	map<string,ll>::iterator it;
	unsigned p=0, i; 
	vector <ll> nums; 
	vector <string> sorted; 
	char buf[64]; 
	
	init_map(); 
	
	//freopen("p1603.in", "r", stdin); 
	
	getline(cin, line); 
	
	while(p<line.size()) {
		string token = get_token(line, p); 
		if (token.size()==0)
			break; 
		//cout<<"token=["<<token<<"]\n"; 
		it = num_map.find(token); 
		if (it!=num_map.end()) {
			nums.push_back(it->second); 
		}
	}
	for (i=0; i<nums.size(); i++) {
		unsigned v = (unsigned)(nums[i]*nums[i]) % 100; 
		sprintf(buf, "%02u", v); 
		sorted.push_back(string(buf)); 
		//cout<<nums[i]<<", "<<buf<<"\n"; 
	}
	sort(sorted.begin(), sorted.end()); 
	
	int omit = 1; 
	for (i=0; i<sorted.size(); i++) {
		if (omit) {
			if (sorted[i]!="00") {
				if (sorted[i][0]!='0') {
					cout<<sorted[i][0]; 
				}
				cout<<sorted[i][1]; 
				omit = 0; 
			}
		} else {
			cout<<sorted[i]; 
		}
	}
	if (omit) 
		cout<<"0"; 
	cout<<"\n"; 

	return 0; 
}


